package com.lyj.controller;

import com.lyj.pojo.Nurse;
import com.lyj.pojo.Vacation;
import com.lyj.service.NurseManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class NurseManageController {

    @Autowired
    NurseManageService nurseManageService;
//查询全部护工
    @RequestMapping("/queryAllNurse")
    @ResponseBody
    public List<Nurse> queryAllNurse(){
        List<Nurse> nurseList = nurseManageService.queryAllNurse();

        return nurseList;
    }
    //关键字搜索，

    @RequestMapping("/queryNurseByName")
    @ResponseBody
    public List<Nurse> queryNurseByName(String username){
        List<Nurse> nurseList = nurseManageService.queryNurseByName(username);

        return nurseList;
    }


// 增加护工
@RequestMapping("/addNurse")
@ResponseBody
public Boolean addNurse(Nurse nurse){

        nurse.setDuty("护工");
    Boolean aBoolean = nurseManageService.addNurse(nurse);

    return aBoolean;
}

    //修改护工，之前写过了
   // updateNurseById

    //删除护工
    @RequestMapping("/delNurseById")
    @ResponseBody
    public Boolean delNurseById(int nurseId){
        Boolean aBoolean = nurseManageService.delNurseById(nurseId);
        return aBoolean;

    }


}
